package com.ruoyi.enums;

import java.util.HashMap;
import java.util.Map;
import lombok.Getter;

@Getter
public enum ChannelPushEnum {

    CRM_CHANNEL("通融", "crm_channel", new HashMap<String, String>() {
        {
            put("saveChannelPushCrm", "保存推送记录");
            put("telCheck", "撞库");
        }
    }),

    CF_CRM_CHANNEL("成方渠道", "cf_crm_channel", new HashMap<String, String>() {
        {
            put("cfCrm", "保存成方渠道信息");
        }
    });

    private final String label;
    private final String value;
    private final Map<String, String> portInfo;

    ChannelPushEnum(String label, String value, Map<String, String> portInfo) {
        this.label = label;
        this.value = value;
        this.portInfo = portInfo;
    }

    public static String of(String value, String key) {
        ChannelPushEnum[] values = values();
        for (ChannelPushEnum channelPushEnum : values) {
            if (channelPushEnum.getValue().equals(value)) {
                return channelPushEnum.getPortInfo().get(key);
            }
        }
        return "";
    }
}
